package com.taotao.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.taotao.mapper.TbUserMapper;
import com.taotao.mapper.UserMapper;
import com.taotao.pojo.TbUser;

import Utils.ObjectResult;


@Service
public class UserService extends BaseService<TbUser>{
	@Autowired
	private TbUserMapper tbuserMapper;
	@Autowired
	private UserMapper userMapper;
//	@Autowired
//	private GenericUserMapper genericUserMapper;
	
	public ObjectResult queryAll(Integer page,Integer rows){
		PageHelper.startPage(page, rows);   
		List<TbUser> list = userMapper.queryAll();
		PageInfo<TbUser> pageInfo = new PageInfo<>(list);
		 return new ObjectResult((long)pageInfo.getTotal(),pageInfo.getList());
	}
	
//	public TbUser findUserById(Long id){
////		TbUser user = tbuserMapper.selectByPrimaryKey(id);
//		
//		TbUser tbUser = new TbUser();
//		tbUser.setId((long) id);
//		TbUser user = genericUserMapper.selectOne(tbUser);
//		
//	     return user;
//	}
//	
//	public int saveUser(TbUser user){
//		user.setCreated(new Date());
//		user.setUpdated(new Date());
//		int insertSelective = genericUserMapper.insertSelective(user);
//		return insertSelective;
//	}
//
//	public int deleteUserByid(Long id) {
//		int status = genericUserMapper.deleteByPrimaryKey(id);
//		return status;
//	}

	 
}


